<template>
  <div class="container">
    <baleTable :tableData="tableData" :tableHead="tableHead" :isSearch="true" :tableLoading="tableLoading" :page="page"
      @pageSizeChange="pageSizeChange" @handleCurrentChange="handleCurrentChange" @searchMethods="searchMethods"
      @tableSortChange="tableSortChange" ref="baleTable">
      <template #icon="{ scope }">
        <div @click.stop="">
          <tablePrImg v-if="scope.row.icon" :imgSrc="scope.row.icon" :prImgList="[scope.row.icon]" />
        </div>
      </template>
      <!-- 等级 -->
      <template #skill="{ scope }">
        {{ formmateSkill(scope.row.skill) }}
      </template>

    </baleTable>

  </div>
</template>

<script>
import {
  ApiGetComplaint,
  ApiDoctorDel,
  ApiResetPassword,
  Apiitem,
} from "@a/index";
import { tableHead } from "./config";
//获取用户列表数据
/* import userList from "./component/userList.vue"; */
export default {

  data() {
    return {
      tableHead,
      tableData: [],
      page: {
        page: 1,
        size: 25,
        total: 0,
      },
      tableLoading: false,
      searchParams: {},
      sortParams: {},
      editFormVisible: false,
      btnLoading: false,
      catList: [],
    };
  },
  mounted() {
    this.getTableData();
  },
  methods: {

    getTableData(params = {}) {
      let postParams = {
        ...params,
        ...this.searchParams,
        ...this.sortParams,
        ...this.page,
      };
      this.tableLoading = true;
      ApiGetComplaint(postParams).then((res) => {
        let { data, page } = res;
        this.tableData = data;
        this.page.total = page.total;
        this.tableLoading = false;
      });
    },
    searchMethods(params) {
      this.searchParams = {};
      this.page.page = 1;
      this.searchParams = params;
      this.getTableData();
    },
    pageSizeChange(val) {
      this.page.size = val;
      this.getTableData();
    },
    handleCurrentChange(val) {
      this.page.page = val;
      this.getTableData();
    },
    tableSortChange(params) {
      if (params.sort_str) {
        this.sortParams = { ...this.sortParams, ...params };
      } else {
        delete this.sortParams.sort_str;
        delete this.sortParams.sort_order;
      }
      this.page.page = 1;
      this.getTableData();
    },



  },
  filters: {},
};
</script>

<style lang="less" scoped></style>
